<template>
  <!-- #ifndef MP-TOUTIAO -->
  <custom-nav-bar title="公告详情"></custom-nav-bar>
  <!-- #endif -->
  <view class="noticeLayout">
    <view class="title">
      <view class="tag" v-if="detail.select == 1">
        <uni-tag inverted text="置顶" type="error" />
      </view>
      <view class="font">{{ detail.noticeTitle }}</view>
    </view>
    <rich-text :nodes="detail.noticeContent"></rich-text>
    <view class="info">
      <view class="item">{{ detail.remark }}</view>

      <view class="item">
        <uni-dateformat :date="detail.createTime" format="yyyy-MM-dd hh:mm:ss"></uni-dateformat>
      </view>
    </view>

    <view class="content">
      <mp-html :content="detail.noticeContent" />
      <!-- <rich-text :nodes="detail.content"></rich-text> -->
    </view>
  </view>
</template>

<script setup>
import { apiNoticeDetail } from '@/api/apis.js'
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import CustomNavBar from '@/components/custom-nav-bar/custom-nav-bar.vue'

const detail = ref({})
let noticeId
onLoad((e) => {
  // console.log(e)
  noticeId = e.id
  getNoticeDetail()
})

const getNoticeDetail = () => {
  apiNoticeDetail(noticeId).then((res) => {
    detail.value = res.data
    console.log(res)
  })
}
</script>

<style lang="scss" scoped>
.noticeLayout {
  padding: 30rpx;

  .title {
    font-size: 40rpx;
    color: #111;
    line-height: 1.6em;
    padding-bottom: 30rpx;
    display: flex;

    .tag {
      transform: scale(0.8);
      transform-origin: left center;
      flex-shrink: 0;
    }

    .font {
      padding-left: 6rpx;
    }
  }

  .info {
    display: flex;
    align-items: center;
    color: #999;
    font-size: 28rpx;

    .item {
      padding-right: 20rpx;
    }
  }

  .content {
    padding: 50rpx 0;
  }

  .count {
    color: #999;
    font-size: 28rpx;
  }
}
</style>
